﻿using System;
using System.Collections.Generic;

namespace Keyki.XNAGameEngine
{
	internal class GameObjectManager
	{
		private readonly List<Game2DObject> m_gameObjects;

		public GameObjectManager()
		{
			m_gameObjects = new List<Game2DObject>();
		}

//GameObjectManager

		public Game2DObject this[int index]
		{
			get
			{
				if (index > m_gameObjects.Count || index < 0)
					throw new IndexOutOfRangeException(String.Format("[GameObjectManager] index {0} is out of range", index));

				return m_gameObjects[index];
			} //get
		}

// this[index]

		public void Add(Game2DObject obj)
		{
			m_gameObjects.Add(obj);
		}

//Add

		public void Remove(int index)
		{
			m_gameObjects.RemoveAt(index);
		}
	}

//class GameObjectManager
}

//namespace Keyki.XNAGameEngine